<template>
   <div class="app-container"><h4>汇总余额</h4>
   <!-- <b>BTC: {{balance['BTC']}},</b>
   <b>ETH: {{balance['ETH']}},</b>
   <b>USDT: {{balance['USDT']}},</b>
   <b>USDC: {{balance['USDC']}},</b> -->
   <b>USDT: {{balance['USDT']}}</b>
   <br><br>
   <h4>分账户余额</h4>
    <el-table v-loading="loading" :data="balance['list']">
      <el-table-column label="手机号" align="center" prop="receiverPhone" />
      <el-table-column label="币种" align="center" prop="coin" />
      <el-table-column label="余额" align="center" prop="balance" />
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
      :page-sizes="[100, 200, 300]"
      :page-size="100"
    />

  </div>
</template>
<script>
import { getBalance, getReceiver } from "@/api/bizmanage/balance";

export default {
  name: "Client",
  data() {
    return {
      // 遮罩层
      loading: true,
      balance: {'BTC':0,'ETH':0,'USDT':0,'USDT2':0,'USDC':0,list:[]},
      total:0,
      queryParams: {
        pageNum: 1,
        pageSize: 100
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询终端列表 */
    getList() {
      this.loading = true;
      getReceiver(this.$store.state.user['apikey']).then(recvResp => {
        if(recvResp.data.length > 0){
          let phones = ""
          for(let i=0; i< recvResp.data.length; i++){
            phones += recvResp.data[i] + ","
          }
          phones = phones.substring(0,phones.length-1)
          getBalance(phones).then(response => {
            this.balance = response.data;
            this.total = response.data.list.length;
            this.loading = false;
          });
        }
      })
    }
  }
};

</script>
<style>
</style>
